package com.lesson01_JavaBase.collection;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.TreeSet;

public class SetTest {
    public static void main(String[] args) {
        HashSet list =new HashSet();
        list.add(1);
        list.add("aaa");
        list.add("aaa");
        list.add(3.14);

        Iterator iterator = list.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }


        TreeSet treeSet = new TreeSet();
        treeSet.add("1");
        treeSet.add("aaa");
        treeSet.add("aaa");
        treeSet.add("3.14");

        Iterator iterator2 = treeSet.iterator();
        while (iterator2.hasNext()) {
            System.out.println(iterator2.next());
        }
    }
}
